﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using KinectXNATools;

namespace KinnectInput.KinectMetro
{
    public class KinectMetroCardContainer
    {
        public Vector2 Position { get; private set; }
        public Rectangle Bounds{
            get
            {
                Point p=XNAMathHelper.ToPoint(this.Position);
                Point size=new Point(MenuItemSizes.separation,MenuItemSizes.separation);
                foreach(KinectMetroButtonGrp btnGrp in ButtonGroups){
                    size.X+=btnGrp.Bounds.Width+MenuItemSizes.separation;
                    size.Y+=btnGrp.Bounds.Height+MenuItemSizes.separation;
                }
                return new Rectangle(p.X,p.Y,size.X,size.Y);
            }
        }
        public KinectMetroButtonGrp [] ButtonGroups {get; private set;}

        public KinectMetroCardContainer(Vector2 position, KinectMetroButtonGrp[] buttonGroups)
        {
            this.Position = position;
            this.ButtonGroups = buttonGroups;
            foreach (KinectMetroButtonGrp kmbtn in ButtonGroups)
            {
                kmbtn.BuildGroup(this);
            }
        }
        public void Update()
        {
            for (int i = 0; i < this.ButtonGroups.Length; i++)
            {
                ButtonGroups[i].Update();
            }
        }
        public void Draw()
        {
            foreach (KinectMetroButtonGrp btnGrp in ButtonGroups)
            {
                btnGrp.Draw();
            }
        }
    }
}
